// MESSAGE MANUAL_CONTROL support class

#pragma once

namespace mavlink {
namespace fppa {
namespace msg {

/**
 * @brief MANUAL_CONTROL message
 *
 * manual control beam target
 */
struct MANUAL_CONTROL : mavlink::Message {
    static constexpr msgid_t MSG_ID = 200;
    static constexpr size_t LENGTH = 30;
    static constexpr size_t MIN_LENGTH = 30;
    static constexpr uint8_t CRC_EXTRA = 28;
    static constexpr auto NAME = "MANUAL_CONTROL";


    uint8_t com_mode; /*<  static or dynamic communication. */
    uint8_t ctrl_mode; /*<  absolute or relative control. */
    float abs_pitch; /*<  pitch. */
    float abs_yaw; /*<  yaw. */
    float abs_polar; /*<  polar. */
    float rel_pitch; /*<  pitch. */
    float rel_yaw; /*<  yaw. */
    float res1; /*<  res1. */
    float res2; /*<  res2. */


    inline std::string get_name(void) const override
    {
            return NAME;
    }

    inline Info get_message_info(void) const override
    {
            return { MSG_ID, LENGTH, MIN_LENGTH, CRC_EXTRA };
    }

    inline std::string to_yaml(void) const override
    {
        std::stringstream ss;

        ss << NAME << ":" << std::endl;
        ss << "  com_mode: " << +com_mode << std::endl;
        ss << "  ctrl_mode: " << +ctrl_mode << std::endl;
        ss << "  abs_pitch: " << abs_pitch << std::endl;
        ss << "  abs_yaw: " << abs_yaw << std::endl;
        ss << "  abs_polar: " << abs_polar << std::endl;
        ss << "  rel_pitch: " << rel_pitch << std::endl;
        ss << "  rel_yaw: " << rel_yaw << std::endl;
        ss << "  res1: " << res1 << std::endl;
        ss << "  res2: " << res2 << std::endl;

        return ss.str();
    }

    inline void serialize(mavlink::MsgMap &map) const override
    {
        map.reset(MSG_ID, LENGTH);

        map << abs_pitch;                     // offset: 0
        map << abs_yaw;                       // offset: 4
        map << abs_polar;                     // offset: 8
        map << rel_pitch;                     // offset: 12
        map << rel_yaw;                       // offset: 16
        map << res1;                          // offset: 20
        map << res2;                          // offset: 24
        map << com_mode;                      // offset: 28
        map << ctrl_mode;                     // offset: 29
    }

    inline void deserialize(mavlink::MsgMap &map) override
    {
        map >> abs_pitch;                     // offset: 0
        map >> abs_yaw;                       // offset: 4
        map >> abs_polar;                     // offset: 8
        map >> rel_pitch;                     // offset: 12
        map >> rel_yaw;                       // offset: 16
        map >> res1;                          // offset: 20
        map >> res2;                          // offset: 24
        map >> com_mode;                      // offset: 28
        map >> ctrl_mode;                     // offset: 29
    }
};

} // namespace msg
} // namespace fppa
} // namespace mavlink
